
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Taotie Ren


# import json #序列化
# import pickle#反序列化
import json

# dic = {'k1':'v1'}
# print(dic,type(dic))
# #将python的基本数据类型转化成字符串类型
# result = json.dumps(dic)
# print(result,type(result))

# s1 = '{"k1":123}'
# import json
#
# dic = json.loads(s1)
# print(dic,type(dic))

# import json
# import requests
# r = requests.get('http://wthrcdn.etouch.cn/weather_mini?city=广州')
# r.encoding = 'utf-8'
# print(r.text, type(r.text))
# dic = json.loads(r.text)
# print(dic,type(dic))


'''
import json
#python 基本数据类型转换成字符串
r = json.dumps([11,22])
li = '["Tom"]'
# li = "['Tom']"#反序列化时，使用双引号 ”
ret = json.loads(li)
print(r,type(r),ret,type(ret))
'''


# import json
# # json.dump()
# # json.load()
# # li = [11,22,33]
# # json.dump(li,open('db','w'))
#
# li = json.load(open('db','r'))
# print(type(li),li)


import pickle
#
# li = [11,22,33]
# r = pickle.dumps(li)
# print(r)
#
# ret = pickle.loads(r)
# print(ret)

li = [11,22,33]
# pickle.dump(li,open('db','wb'))

r = pickle.load(open('db',"rb"))
print(r)

# json/pickle
#
# json  更加适合跨语言，字符串，基本数据类型
#
# pickle python所有类型的序列化操作，仅适用于python
#























